from untils.card_info import url_login,cookie,phone_login,passwd_login
from untils.mylogger import logger
import requests

'''获取官网登录时的token'''
def login_tokin():
    header = {
        "Cookies":cookie
    }
    body_log = {
        "mobile":phone_login,
        "password":passwd_login
    }
    rs_log = requests.post(url=url_login,headers=header,json=body_log)
    logger.debug(f"输入路径为{url_login},请求头{header},入参{body_log}")
    logger.debug(f'返回的状体码{rs_log.status_code},返回的结果{rs_log.text}')
    login_token = rs_log.json()['data']['accessToken']
    assert rs_log.status_code == 200
    return login_token


token = login_tokin()
